-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support unseekable filestream when ReadAllBytes[Async] #58434
Support unseekable filestream when ReadAllBytes[Async] #58434
Conversation
…dAllBytes[Async].
Tagging subscribers to this area: @dotnet/area-system-io Issue Details…dAllBytes[Async]. Fix #58383 , will update PR status when it is ready for review.
|
…issue-58383-SupportUnSeekableReadBytes # Conflicts: # src/libraries/System.Private.CoreLib/src/System/IO/RandomAccess.Windows.cs
src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytes.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytes.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytes.cs
Outdated
Show resolved
Hide resolved
It looks like there is some difference in how character devices are treated in .NET 5 vs. .NET 6. e.g. this simple console program: using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
//using Xunit;
FileTests fileTests = new();
await fileTests.ReadAllBytes_NonSeekableFileStream_InUnix();
Console.WriteLine("Passed!");
public class FileTests
{
// [Fact]
public async Task ReadAllBytes_NonSeekableFileStream_InUnix()
{
var path = "/dev/tty";
if (!File.Exists(path))
{
throw new Exception(path + " is not available in this environment.");
}
var contentBytes = new byte[] { 1, 2, 3 };
using (var cts = new CancellationTokenSource())
{
Task writingTask = File.WriteAllBytesAsync(path, contentBytes, cts.Token);
cts.CancelAfter(TimeSpan.FromMilliseconds(500));
await writingTask;
}
}
} prints @tmds, @stephentoub, is this a known breaking change? |
Not to my knowledge. |
On Linux, it prints From the CI stack trace it looks like the @am11 can you create an issue for this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, big thanks for your contribution @lateapexearlyspeed !
/backport to release/6.0 |
Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1412920156 |
@adamsitnik backporting to release/6.0 failed, the patch most likely resulted in conflicts: $ git am --3way --ignore-whitespace --keep-non-patch changes.patch
Applying: lateapexearlyspeed-issue-58383 Support unseekable filestream when ReadAllBytes[Async].
Applying: issue-58383 Refine code; Add test cases.
Applying: the docs were wrong, offsets are not ignored for non-seekable files
Using index info to reconstruct a base tree...
M src/libraries/System.Private.CoreLib/src/System/IO/RandomAccess.Windows.cs
Falling back to patching base and 3-way merge...
Auto-merging src/libraries/System.Private.CoreLib/src/System/IO/RandomAccess.Windows.cs
CONFLICT (content): Merge conflict in src/libraries/System.Private.CoreLib/src/System/IO/RandomAccess.Windows.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0003 the docs were wrong, offsets are not ignored for non-seekable files
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128 Please backport manually! |
Co-authored-by: Adam Sitnik <[email protected]>
Co-authored-by: Adam Sitnik <[email protected]> Co-authored-by: LateApexEarlySpeed <[email protected]>
…dAllBytes[Async].
Fix #58383 , will update PR status when it is ready for review.